<?php

namespace App\Console\Commands;

use App\Service\ConfigCenterService;
use Illuminate\Console\Command;

/**
 * 配置中心的客户端
 * @author vijay
 */
class ConfigCenterCmd extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'configCenter:start';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '启动配置中心客户端';

    /** @var ConfigCenterService */
    private $configCenterService;

    /**
     * Create a new command instance.
     *
     * @param ConfigCenterService $configCenterService
     */
    public function __construct(ConfigCenterService $configCenterService)
    {
        parent::__construct();
        $this->configCenterService = $configCenterService;
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $this->configCenterService->readConfig();
        return 0;
    }
}
